const { ipcMain } = require('electron');
const SearchService = require('../services/SearchService');

function registerSearchHandlers() {
    ipcMain.handle('search:global', async (event, { caseId, query, options }) => {
        try {
            return await SearchService.search(caseId, query, options);
        } catch (error) {
            console.error('Search failed:', error);
            throw error;
        }
    });
}

module.exports = { registerSearchHandlers };
